<?php
/**
 * Single Product Meta
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

global $post, $product;
?>
<div class="product_meta">
    
        <?php do_action( 'woocommerce_product_meta_start' ); ?>

	<?php if ( $product->is_type( array( 'simple', 'variable' ) ) && get_option( 'woocommerce_enable_sku' ) == 'yes' && $product->get_sku() ) : ?>
		<span itemprop="productID" class="sku_wrapper"><?php _e( 'SKU:', 'woocommerce' ); ?> <span class="sku"><?php echo $product->get_sku(); ?></span>.</span>
	<?php endif; ?>

	<?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', sizeof( get_the_terms( $post->ID, 'product_cat' ) ), 'woocommerce' ) . ' ', '.</span>' ); ?>

	<?php echo $product->get_tags( ', ', '<span class="tagged_as">' . _n( 'Tag:', 'Tags:', sizeof( get_the_terms( $post->ID, 'product_tag' ) ), 'woocommerce' ) . ' ', '.</span>' ); ?>

	<?php do_action( 'woocommerce_product_meta_end' ); ?>
                
        
        <?php // Generate The Addon & Upgrade Products
	if(get_field('addonupgradeproducts')) { ?>
    
                <div style="width:100%;height:1px;background:#cccccc;margin-bottom:10px;"></div>
                <p style="font-size:15px;font-weight:bold;color:#263692;">Upgrades &amp; Recommended Add-Ons:</p>

		<?php while(has_sub_field('addonupgradeproducts')) : ?>

			<?php
				$addonproductid = get_sub_field('addonupgradeproductid');
				$addonproducttext = get_sub_field('addonupgradeproducttext');
			?>

			<?php $addonproduct = new wp_query('post_type=product&number_posts=1&p='.$addonproductid.''); ?>
				<?php while($addonproduct->have_posts()) : $addonproduct->the_post(); ?>
                                        
                                        <?php
                                            if (get_field('productFeaturedImage') != '') {
                                                $productimageurl = get_field('productFeaturedImage');
                                            } else {
                                                $productimageurl = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ));
                                                $productimageurl = $productimageurl[0];
                                            }
                                        ?>
                
                                        <style>
                                            .topaddonproduct div, .single-product .product .summary .topaddonproduct p.price { font-size:20px;padding:0px;margin:0px;padding-top:0px; }
                                            .single-product .product .summary .topaddonproduct form.cart { margin-bottom:0px; }
                                        </style>
                
					<p style="font-size:12px;font-weight:bold;line-height:12px;margin:0px;margin-bottom:10px;"><?php echo $addonproducttext; ?></p>
                                        <div class="topaddonproduct" style="padding:10px;border:#cccccc 1px solid;margin-bottom:10px;">
                                            <a href="<?php the_permalink(); ?>" title="View Product Details"><img src="<?php echo $productimageurl; ?>" alt="<?php the_title(); ?>" title="View Product Details" style="width:120px;height:120px;float:left;margin:0px;margin-right:20px;" /></a>
                                            <p style="font-size:14px;font-weight:bold;"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
                                            <?php include '/home/silicons/public_html/wp-content/themes/woostore/woocommerce/single-product/price.php'; ?>
                                            <?php include '/home/silicons/public_html/wp-content/plugins/woocommerce/templates/single-product/add-to-cart/simple.php'; ?>
                                            <div style="width:100%;height:0px;clear:both;"></div>
                                        </div>

				<?php endwhile; ?>
			<?php wp_reset_query(); ?>
		
		<?php endwhile; ?>

        <?php } ?>
        

        <p>
            <br><strong>Interested In Becoming A Wholesaler?</strong><br>
            Silicon Solar is looking to partner with online and offline solar product resellers.  Interested? <strong><a href="/../wholesale-dropshipping.html">Read more &amp; apply today</a></strong>!
        </p>

</div>